
public class Node {
	int value;
	Node left;
	Node right;
	Node parent;
	public Node(int value) {
		super();
		this.value = value;
	}
	public void inOrder(Visitor visitor){
		if (left != null){
			left.inOrder(visitor);
		}
		visitor.visit(this);
		if (right != null){
			right.inOrder(visitor);
		}
	}
	public void preOrder(Visitor visitor){
		visitor.visit(this);
		if (left != null){
			left.preOrder(visitor);
		}
		if (right != null)
		{
			right.preOrder(visitor);
		}
	}
	public void postOrder(Visitor visitor){
		if (left != null){
			left.postOrder(visitor);
		}
		if (right != null){
			right.postOrder(visitor);
		}
		visitor.visit(this);
	}
}
